﻿#define _CRT_SECURE_NO_WARNINGS
// ↑ 将本行在代码放在第一行可以避免 scanf的报错问题（仅在VS编译器里）
//【初阶】40.链表收尾
//【初阶】41.双向链表
//【初阶】42.休息
//【初阶】43.双向链表的实现

//【头文件包含】
#include"DoubleList.h"

//【函数声明】
void DoubleListTest1();

//【主函数】
int main()
{
	DoubleListTest1();
	
	return 0;
}

//【函数】
/*双向链表测试用例*/void DoubleListTest1()
{
	DBLN* plist = NULL;
	printf("初始化\n");
	plist= DoubleListInit(plist);
	printf("尾插1,2,3,4,5\n");
	DoubleListPushBack(plist, 1);
	DoubleListPushBack(plist, 2);
	DoubleListPushBack(plist, 3);
	DoubleListPushBack(plist, 4);
	DoubleListPushBack(plist, 5);
	DoubleListPrint(plist);
	printf("尾删1次\n");
	DoubleListPopBack(plist);
	DoubleListPrint(plist);
	printf("头插6,7,8\n");
	DoubleListPushFront(plist, 6);
	DoubleListPushFront(plist, 7);
	DoubleListPushFront(plist, 8);
	DoubleListPrint(plist);
	printf("尾删2次\n");
	DoubleListPopFront(plist);
	DoubleListPopFront(plist);
	DoubleListPrint(plist);
	printf("查询值为3的节点\n");
	DBLN* ret=DoubleListNodeSearch(plist, 3);
	printf("ret=%d\n", ret->data);
	printf("从上查到的节点值位置插入5\n");
	DoubleListInsert(ret, 5);
	DoubleListPrint(plist);
	printf("删除从上查到的节点值位置\n");
	DoubleListErase(ret);
	DoubleListPrint(plist);

}
/**/


//【笔记】
//【初阶】41.双向链表
//链表分为：单向、双向|带头、不带头|循环、非循环
// 本次学习的为最复杂的带头双向循环链表